<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-movieuser-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户姓名：</label>
				<div class="col-sm-8">
					<input id="userName" name="userName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户登录名：</label>
				<div class="col-sm-8">
					<input id="loginname" name="loginname" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户登陆密码：</label>
				<div class="col-sm-8">
					<input id="loginpassword" name="loginpassword" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">用户性别：</label>
				<div class="col-sm-8">
					<select name="sex" th:with="type=${@dict.getType('sys_user_sex')}" class="form-control" style="width: 500px">
						<option value="">所有</option>
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="onoffswitch">
						<input type="checkbox"  class="onoffswitch-checkbox" id="status" name="status">
						<label class="onoffswitch-label" for="status">
							<span class="onoffswitch-inner"></span>
							<span class="onoffswitch-switch"></span>
						</label>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/movieuser"
		$("#form-movieuser-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			submitHandler: function(form) {
				add();
			}
		});
        function add() {
            var userId = $("input[name='userId']").val();
            var userName = $("input[name='userName']").val();
            var loginname = $("input[name='loginname']").val();
            var loginpassword = $("input[name='loginpassword']").val();
            var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
            var remark = $("input[name='remark']").val();
            var sex = $("select[name='sex']").val();
            $.ajax({
                cache : true,
                type : "POST",
                url : ctx + "module/movieuser/add",
                data : {
                    "userName": userName,
                    "loginname": loginname,
                    "loginpassword": loginpassword,
                    "status": status,
                    "remark": remark,
                    "sex": sex
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.saveSuccess(data);
                }
            });
        }
	</script>
</body>
</html>
